package com.yunhe.dao;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.yunhe.entity.Category;
import com.yunhe.entity.Supplier;
import com.yunhe.util.MyBatisUtil;

public class SupplierImpl implements ISupplier {

	SqlSession ss = MyBatisUtil.getSession();
	@Override
	public int addSupplier(Supplier supplier) {
		int count = ss.insert("com.yunhe.dao.ISupplier.addSupplier", supplier);
		ss.commit();
		ss.close();
		return count;
	}

	@Override
	public List<Supplier> getAllSupplier() {
		List<Supplier> list = ss.selectList("com.yunhe.dao.ISupplier.getAllSupplier");
		ss.close();
		return list;
	}

	@Override
	public int delSupplier(Supplier supplier) {
		int count = ss.delete("com.yunhe.dao.ISupplier.delSupplier", supplier);
		ss.commit();
		ss.close();
		return count;
	}

}
